package com.cyh.server.enums;

import lombok.Getter;

@Getter
public enum DatabaseType {

    MYSQL("mysql", "com.mysql.cj.jdbc.Driver"),
    POSTGRESQL("postgresql","org.postgresql.Driver"),
    SQLSERVER("sqlserver", "com.microsoft.sqlserver.jdbc.SQLServerDriver")
    ;

    private final String name;
    private final String driverClass;

    DatabaseType(String name, String driverClass) {
        this.name = name;
        this.driverClass = driverClass;
    }

    public static DatabaseType getByName(String name) {
        for (DatabaseType type : values()) {
            if (type.name.equals(name)) {
                return type;
            }
        }
        return null;
    }

}